using System.Collections.Generic;
using CodePlex.DnD4eCampaignManager.CampaignManagerControlLibrary;
using CodePlex.DnD4eCampaignManager.DnD4e;
using CodePlex.DnD4eCampaignManager.DnD4e.Enums;
using CodePlex.DnD4eCampaignManager.DnD4e.Interfaces;
using CodePlex.DnD4eCampaignManager.Services;
using CodePlex.DnD4eCampaignManager.Services.Interfaces;
using NUnit.Framework;

namespace CodePlex.DnD4eCampaignManager.CampaignManagerTests.ServiceTests
{
    [TestFixture]
    public class DungeonsAndDragonsInsiderMonsterImporterTests
    {
        private string _password;
        private string _userName;

        [Test]
        public void FindAllMonstersReturnsCollectionOfMonsterNamesAndIds()
        {
            IDungeonsAndDragonsInsiderMonsterImporter monsterImporter = new DungeonsAndDragonsInsiderMonsterImporter(_userName, _password);
            Assert.Fail("NotImplemented");
        }

        [Test]
        public void FindMatchingMonstersBySearchTermReturnsCollectionOfAllMonsterNamesAndIdsMatchingSearchTerm()
        {
            IDungeonsAndDragonsInsiderMonsterImporter monsterImporter = new DungeonsAndDragonsInsiderMonsterImporter(_userName, _password);
            Assert.Fail("NotImplemented");
        }

        [Test]
        public void GetMonsterByIdReturnsMonster()
        {
            IMonster goblinUnderboss = new Monster(new Abilities(), new Defenses(), new HitPoints(), new Movement(), new Senses(), new Initiative())
                                           {
                                               AbilityCharisma = 16,
                                               AbilityConstitution = 15,
                                               AbilityDexterity = 14,
                                               AbilityIntelligence = 11,
                                               AbilityStrength = 18,
                                               AbilityWisdom = 13,
                                               ActionPoints = 1,
                                               CreatureSize = CreatureSize.Small,
                                               DefenseArmorClass = 18,
                                               DefenseFortitude = 17,
                                               DefenseReflex = 15,
                                               DefenseWillpower = 16,
                                               HitPointsCurrent = 0,
                                               HitPointsMaximum = 110,
                                               HitPointsTemporary = 0,
                                               InitiativeModifier = 4,
                                               InitiativeRoll = 1,
                                               InitiativeScore = 5,
                                               MovementSpeed = 5,
                                               MovementSpeedOther = string.Empty,
                                               MovementStealth = 10,
                                               Name = "Goblin Underboss",
                                               SensesInsight = 0,
                                               SensesInsightPassive = 0,
                                               SensesOther = "low-light vision",
                                               SensesPerception = 8,
                                               SensesPerceptionPassive = 0,
                                               SpecialQualities =
                                                   @"Superior Goblin Tactics (immediate reaction, when missed by a melee attack, at-will)
The goblin underboss and up to two allies within its line of sight shift 1 square.

Survival Instinct 
The goblin underboss gains a +3 bonus to defenses while bloodied.",
                                               AttackPowers =
                                                   @"Short Sword (Standard, at-will, Weapon)
+9 vs Armor Class; 1d6+4 damage. Miss: An adjacent ally makes a free basic attack.",
                                               Elite = true,
                                               Equipment = "chainmail , short sword",
                                               Index = null,
                                               Origin = "Natural",
                                               Keywords = new List<string> { "Humanoid", "Goblin" },
                                               Leader = true,
                                               Level = 4,
                                               Role = MonsterRole.Controller,
                                               SavingThrows = 2,
                                               Solo = false
                                           };
            IDungeonsAndDragonsInsiderMonsterImporter monsterImporter = new DungeonsAndDragonsInsiderMonsterImporter(_userName, _password);
            Monster importedMonster = monsterImporter.ImportMonster(728);
            Assert.AreEqual(goblinUnderboss.ToXmlString(), importedMonster.ToXmlString());
        }

        [TestFixtureSetUp]
        public void SetUp()
        {
            _userName = ModalStringPicker.GetString("D&D Insider Username", "Enter your D&D Insider username", string.Empty, 400);
            _password = ModalStringPicker.GetString("D&D Insider Password", "Enter your D&D Insider password", string.Empty, 400, '*');
        }
    }
}